home *** CD-ROM | disk | FTP | other *** search
/ CD School House 9 / CD School House 9.0 - Wayzata Technology (1994).iso / pc / dos / math / fsultra1 / timings.c < prev    next >
Text File  |  1992-06-18  |  3KB  |  93 lines

  1. /* 
  2. FSU - ULTRA    The greatest random number generator that ever was
  3.         or ever will be.  Way beyond Super-Duper.
  4.         (Just kidding, but we think its a good one.)
  5.  
  6. Authors:    Arif Zaman (arif@stat.fsu.edu) and
  7.         George Marsaglia (geo@stat.fsu.edu).
  8.  
  9. Date:        27 May 1992
  10.  
  11. Version:    1.05
  12.  
  13. Copyright:    To obtain permission to incorporate this program into
  14.         any commercial product, please contact the authors at
  15.         the e-mail address given above or at
  16.  
  17.         Department of Statistics and
  18.         Supercomputer Computations Research Institute
  19.         Florida State University
  20.         Tallahassee, FL 32306.
  21.  
  22. See Also:    README        for a brief description
  23.         ULTRA.DOC    for a detailed description
  24.  
  25. -----------------------------------------------------------------------
  26. */ 
  27. /*
  28.   These are timings of the various subroutines using a precision
  29.   micro-second timer provided in ztimer10.zip
  30. */
  31. #include "ztimer.h"
  32. #include "ultra.h"
  33.  
  34. #define reps 20000
  35.  
  36. int main()
  37. { long l;
  38.   int i,j;
  39.   char c;
  40.  
  41.   printf("Timings in microseconds per call\n\
  42.    dvni   duni    vni    uni  32bit  31bit  16bit  15bit   8bit   7bit   1bit\
  43. \n");
  44.  
  45.   rinit(1234567,7654321);        LZTimerOn();
  46.   for (i=1;i<reps;i++)    dvni();        LZTimerOff();
  47.   printf("%7.2f", LZTimerCount()/(float) reps );
  48.  
  49.   rinit(1234567,7654321);        LZTimerOn();
  50.   for (i=1;i<reps;i++)    duni();        LZTimerOff();
  51.   printf("%7.2f", LZTimerCount()/(float) reps );
  52.  
  53.   rinit(1234567,7654321);        LZTimerOn();
  54.   for (i=1;i<reps;i++)    vni();        LZTimerOff();
  55.   printf("%7.2f", LZTimerCount()/(float) reps );
  56.  
  57.   rinit(1234567,7654321);        LZTimerOn();
  58.   for (i=1;i<reps;i++)    uni();        LZTimerOff();
  59.   printf("%7.2f", LZTimerCount()/(float) reps );
  60.  
  61.   rinit(1234567,7654321);        LZTimerOn();
  62.   for (i=1;i<reps;i++)    
  63.   l=i32bit();
  64.     LZTimerOff();
  65.   printf("%7.2f", LZTimerCount()/(float) reps );
  66.  
  67.   rinit(1234567,7654321);        LZTimerOn();
  68.   for (i=1;i<reps;i++)    i31bit();    LZTimerOff();
  69.   printf("%7.2f", LZTimerCount()/(float) reps );
  70.  
  71.   rinit(1234567,7654321);        LZTimerOn();
  72.   for (i=1;i<reps;i++)    j=i16bit();    LZTimerOff();
  73.   printf("%7.2f", LZTimerCount()/(float) reps );
  74.  
  75.   rinit(1234567,7654321);        LZTimerOn();
  76.   for (i=1;i<reps;i++)    i15bit();    LZTimerOff();
  77.   printf("%7.2f", LZTimerCount()/(float) reps );
  78.  
  79.   rinit(1234567,7654321);        LZTimerOn();
  80.   for (i=1;i<reps;i++)    c=i8bit();    LZTimerOff();
  81.   printf("%7.2f", LZTimerCount()/(float) reps );
  82.  
  83.   rinit(1234567,7654321);        LZTimerOn();
  84.   for (i=1;i<reps;i++)    i7bit();    LZTimerOff();
  85.   printf("%7.2f", LZTimerCount()/(float) reps );
  86.  
  87.   rinit(1234567,7654321);        LZTimerOn();
  88.   for (i=1;i<reps;i++)    i1bit();    LZTimerOff();
  89.   printf("%7.2f\n", LZTimerCount()/(float) reps );
  90.  
  91.   return(0);
  92. }
  93.